<style>
    #add {
        padding: 20px 25px 25px 0;
    }

    #add .layui-treeSelect .ztree li a, .ztree li span {
        margin: 0 0 2px 3px !important;
    }
</style>
<div class="layui-fluid" id="incomeUpdate">
    <form class="layui-form" action="" lay-filter="income-update-form" id="income-update-form">

        <div class="layui-form-item" style="margin-top: 50px">
            <label class="layui-form-label febs-form-item-require">钱包余额</label>
            <div class="layui-input-block">
                <input type="text" autocomplete="off" readonly name="wallet"  class="layui-input">
            </div>
        </div>

        <div class="layui-form-item" style="display: none">
            <label class="layui-form-label febs-form-item-require">客户id</label>
            <div class="layui-input-block">
                <input type="text" name="customerId"  class="layui-input">
            </div>
        </div>

        <div class="layui-form-item" style="margin-top: 50px">
            <label class="layui-form-label febs-form-item-require">本次提现金额</label>
            <div class="layui-input-block">
                <input type="text" placeholder="请输入本次提现金额" name="withdrawPrice" lay-verify="required" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item febs-hide">
            <button class="layui-btn" lay-submit="" lay-filter="incomeUpdate-form-submit" id="submit"></button>
            <button type="reset" class="layui-btn" id="reset"></button>
            <input type="hidden" name="test">
        </div>
    </form>
</div>
<script data-th-inline="javascript">
    layui.use(['febs', 'form', 'layedit', 'validate', 'upload'], function () {
        var $ = layui.$,
            layer = layui.layer,
            form = layui.form,
            $view = $('#incomeUpdate'),
            customer = [[${customer}]],
            validate = layui.validate;

        form.verify(validate);
        form.render();

        initUserValue();

        function initUserValue() {
            form.val("income-update-form", {
                "customerId":customer.customerId,
                "wallet": customer.wallet,
            });
        }

        form.on('submit(incomeUpdate-form-submit)', function (data) {
            var formData = new FormData(document.getElementById("income-update-form"));
            $.ajax({
                url: ctx + 'customer/withDraw',
                data: formData,
                type: 'post',
                dataType: 'json',
                processData: false,
                contentType: false,
                success: function (data) {
                    if (data.code == 200) {
                        layer.msg('操作成功', {
                            icon: 6,
                            time: 1000
                        }, function () {
                            layer.closeAll();
                            $('#febs-income').find('#reset').click();
                            $('#febs-user').find('#reset').click();
                        });
                    } else {
                        layer.msg(data.message, {
                            icon: 5,
                            time: 1000
                        });
                    }
                },
                error: function (data) {
                    layer.msg('操作失败', {
                        icon: 5,
                        time: 1000
                    });
                }
            });
            return false;
        });
    });
</script>